import { state } from "../../config.js";
export var collide = function (bullel, role, cb) {
    var rp = getPoint(role);
    var bp = getPoint(bullel);
    var sumX = Math.abs(rp.x1 + rp.x2 - bp.x1 - bp.x2);
    var x = Math.abs(rp.x1 - rp.x2) + Math.abs(bp.x1 - bp.x2);
    var sumY = Math.abs(rp.y1 + rp.y2 - bp.y1 - bp.y2);
    var y = Math.abs(rp.y1 - rp.y2) + Math.abs(bp.y1 - bp.y2);
    if (sumX <= x - state.roleSpeed / 2 && sumY < y) {
        cb();
    }
};
export var getPoint = function (p) {
    return {
        x1: p.x,
        x2: p.x + p.w,
        y1: p.y,
        y2: p.y + p.h
    };
};
